3.44 \(\int \frac{1}{1+\cos ^2(x)} \, dx\)

Optimal. Leaf size=34 \[ \frac{x}{\sqrt{2}}-\frac{\tan ^{-1}\left (\frac{\sin (x) \cos (x)}{\cos ^2(x)+\sqrt{2}+1}\right )}{\sqrt{2}} \]

[Out]

x/Sqrt[2] - ArcTan[(Cos[x]*Sin[x])/(1 + Sqrt[2] + Cos[x]^2)]/Sqrt[2]

________________________________________________________________________________________

Rubi [A]  time = 0.0129128, antiderivative size = 34, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 8, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.25, Rules used = {3181, 203} \[ \frac{x}{\sqrt{2}}-\frac{\tan ^{-1}\left (\frac{\sin (x) \cos (x)}{\cos ^2(x)+\sqrt{2}+1}\right )}{\sqrt{2}} \]

Antiderivative was successfully verified.

[In]

Int[(1 + Cos[x]^2)^(-1),x]

[Out]

x/Sqrt[2] - ArcTan[(Cos[x]*Sin[x])/(1 + Sqrt[2] + Cos[x]^2)]/Sqrt[2]

Rule 3181

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist
[ff/f, Subst[Int[1/(a + (a + b)*ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{1}{1+\cos ^2(x)} \, dx &=-\operatorname{Subst}\left (\int \frac{1}{1+2 x^2} \, dx,x,\cot (x)\right )\\ &=\frac{x}{\sqrt{2}}-\frac{\tan ^{-1}\left (\frac{\cos (x) \sin (x)}{1+\sqrt{2}+\cos ^2(x)}\right )}{\sqrt{2}}\\ \end{align*}

Mathematica [A]  time = 0.0239075, size = 15, normalized size = 0.44 \[ \frac{\tan ^{-1}\left (\frac{\tan (x)}{\sqrt{2}}\right )}{\sqrt{2}} \]

Antiderivative was successfully verified.

[In]

Integrate[(1 + Cos[x]^2)^(-1),x]

[Out]

ArcTan[Tan[x]/Sqrt[2]]/Sqrt[2]

________________________________________________________________________________________

Maple [A]  time = 0.011, size = 14, normalized size = 0.4 \begin{align*}{\frac{\sqrt{2}}{2}\arctan \left ({\frac{\tan \left ( x \right ) \sqrt{2}}{2}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(1+cos(x)^2),x)

[Out]

1/2*arctan(1/2*tan(x)*2^(1/2))*2^(1/2)

________________________________________________________________________________________

Maxima [A]  time = 1.48428, size = 18, normalized size = 0.53 \begin{align*} \frac{1}{2} \, \sqrt{2} \arctan \left (\frac{1}{2} \, \sqrt{2} \tan \left (x\right )\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+cos(x)^2),x, algorithm="maxima")

[Out]

1/2*sqrt(2)*arctan(1/2*sqrt(2)*tan(x))

________________________________________________________________________________________

Fricas [A]  time = 1.61721, size = 99, normalized size = 2.91 \begin{align*} -\frac{1}{4} \, \sqrt{2} \arctan \left (\frac{3 \, \sqrt{2} \cos \left (x\right )^{2} - \sqrt{2}}{4 \, \cos \left (x\right ) \sin \left (x\right )}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+cos(x)^2),x, algorithm="fricas")

[Out]

-1/4*sqrt(2)*arctan(1/4*(3*sqrt(2)*cos(x)^2 - sqrt(2))/(cos(x)*sin(x)))

________________________________________________________________________________________

Sympy [A]  time = 1.0749, size = 63, normalized size = 1.85 \begin{align*} \frac{\sqrt{2} \left (\operatorname{atan}{\left (\sqrt{2} \tan{\left (\frac{x}{2} \right )} - 1 \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right )}{2} + \frac{\sqrt{2} \left (\operatorname{atan}{\left (\sqrt{2} \tan{\left (\frac{x}{2} \right )} + 1 \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right )}{2} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+cos(x)**2),x)

[Out]

sqrt(2)*(atan(sqrt(2)*tan(x/2) - 1) + pi*floor((x/2 - pi/2)/pi))/2 + sqrt(2)*(atan(sqrt(2)*tan(x/2) + 1) + pi*
floor((x/2 - pi/2)/pi))/2

________________________________________________________________________________________

Giac [A]  time = 1.186, size = 62, normalized size = 1.82 \begin{align*} \frac{1}{2} \, \sqrt{2}{\left (x + \arctan \left (-\frac{\sqrt{2} \sin \left (2 \, x\right ) - \sin \left (2 \, x\right )}{\sqrt{2} \cos \left (2 \, x\right ) + \sqrt{2} - \cos \left (2 \, x\right ) + 1}\right )\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+cos(x)^2),x, algorithm="giac")

[Out]

1/2*sqrt(2)*(x + arctan(-(sqrt(2)*sin(2*x) - sin(2*x))/(sqrt(2)*cos(2*x) + sqrt(2) - cos(2*x) + 1)))